home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 65.zip / BS1 part 65 / DevPac v3.02b.adf / include / libraries / dosextens.i < prev    next >
Text File  |  1991-11-20  |  10KB  |  294 lines

  1.     IFND    LIBRARIES_DOSEXTENS_I
  2. LIBRARIES_DOSEXTENS_I    SET    1
  3. **
  4. **    $Filename: libraries/dosextens.i $
  5. **    $Release: 1.3 $
  6. **
  7. **    DOS structures not needed for the casual AmigaDOS user 
  8. **
  9. **    (C) Copyright 1985,1986,1987,1988 Commodore-Amiga, Inc.
  10. **        All Rights Reserved
  11. **
  12.  
  13.      IFND  EXEC_TYPES_I
  14.      INCLUDE "exec/types.i"
  15.      ENDC
  16.      IFND  EXEC_TASKS_I
  17.      INCLUDE "exec/tasks.i"
  18.      ENDC
  19.      IFND  EXEC_PORTS_I
  20.      INCLUDE "exec/ports.i"
  21.      ENDC
  22.      IFND  EXEC_LIBRARIES_I
  23.      INCLUDE "exec/libraries.i"
  24.      ENDC
  25.  
  26.      IFND  LIBRARIES_DOS_I
  27.      INCLUDE "libraries/dos.i"
  28.      ENDC
  29.  
  30.  
  31. * All DOS processes have this STRUCTure
  32. * Create and DeviceProc returns pointer to the MsgPort in this STRUCTure
  33. * Process_addr = DeviceProc(..) - TC_SIZE
  34.  
  35.  STRUCTURE Process,0
  36.     STRUCT  pr_Task,TC_SIZE
  37.     STRUCT  pr_MsgPort,MP_SIZE    * This is BPTR address from DOS functions
  38.     WORD    pr_Pad        * Remaining variables on 4 byte boundaries
  39.     BPTR    pr_SegList        * Array of seg lists used by this process
  40.     LONG    pr_StackSize    * Size of process stack in bytes
  41.     APTR    pr_GlobVec        * Global vector for this process (BCPL)
  42.     LONG    pr_TaskNum        * CLI task number of zero if not a CLI
  43.     BPTR    pr_StackBase    * Ptr to high memory end of process stack
  44.     LONG    pr_Result2        * Value of secondary result from last call
  45.     BPTR    pr_CurrentDir    * Lock associated with current directory
  46.     BPTR    pr_CIS        * Current CLI Input Stream
  47.     BPTR    pr_COS        * Current CLI Output Stream
  48.     APTR    pr_ConsoleTask    * Console handler process for current window
  49.     APTR    pr_FileSystemTask    * File handler process for current drive
  50.     BPTR    pr_CLI        * pointer to ConsoleLineInterpreter
  51.     APTR    pr_ReturnAddr    * pointer to previous stack frame
  52.     APTR    pr_PktWait        * Function to be called when awaiting msg
  53.     APTR    pr_WindowPtr    * Window pointer for errors
  54.     LABEL   pr_SIZEOF        * Process
  55.  
  56. * The long word address (BPTR) of this STRUCTure is returned by
  57. * Open() and other routines that return a file.     You need only worry
  58. * about this STRUCT to do async io's via PutMsg() instead of
  59. * standard file system calls
  60.  
  61.  STRUCTURE FileHandle,0
  62.    APTR      fh_Link        * pointer to EXEC message
  63.    APTR      fh_Interactive    * Boolean; TRUE if interactive handle
  64.    APTR      fh_Type        * Port to do PutMsg() to
  65.    LONG      fh_Buf
  66.    LONG      fh_Pos
  67.    LONG      fh_End
  68.    LONG      fh_Funcs
  69. fh_Func1 EQU fh_Funcs
  70.    LONG      fh_Func2
  71.    LONG      fh_Func3
  72.    LONG      fh_Args
  73. fh_Arg1 EQU fh_Args
  74.    LONG      fh_Arg2
  75.    LABEL  fh_SIZEOF * FileHandle
  76.  
  77. * This is the extension to EXEC Messages used by DOS
  78.  STRUCTURE DosPacket,0
  79.    APTR      dp_Link      * pointer to EXEC message
  80.    APTR      dp_Port      * pointer to Reply port for the packet
  81. *              * Must be filled in each send.
  82.    LONG      dp_Type      * See ACTION_... below and
  83. *              * 'R' means Read, 'W' means Write to the file system
  84.    LONG      dp_Res1      * For file system calls this is the result
  85. *              * that would have been returned by the
  86. *              * function, e.g. Write ('W') returns actual
  87. *              * length written
  88.    LONG      dp_Res2      * For file system calls this is what would
  89. *              * have been returned by IoErr()
  90.    LONG      dp_Arg1
  91. *  Device packets common equivalents
  92. dp_Action  EQU    dp_Type
  93. dp_Status  EQU    dp_Res1
  94. dp_Status2 EQU    dp_Res2
  95. dp_BufAddr EQU    dp_Arg1
  96.    LONG      dp_Arg2
  97.    LONG      dp_Arg3
  98.    LONG      dp_Arg4
  99.    LONG      dp_Arg5
  100.    LONG      dp_Arg6
  101.    LONG      dp_Arg7
  102.    LABEL  dp_SIZEOF * DosPacket
  103.  
  104. * A Packet does not require the Message to before it in memory, but
  105. * for convenience it is useful to associate the two.
  106. * Also see the function init_std_pkt for initializing this STRUCTure
  107.  
  108.  STRUCTURE StandardPacket,0
  109.    STRUCT sp_Msg,MN_SIZE
  110.    STRUCT sp_Pkt,dp_SIZEOF
  111.    LABEL  sp_SIZEOF * StandardPacket
  112.  
  113.  
  114. * Packet types
  115. ACTION_NIL        EQU    0
  116. ACTION_GET_BLOCK    EQU    2    ;OBSOLETE
  117. ACTION_SET_MAP        EQU    4
  118. ACTION_DIE        EQU    5
  119. ACTION_EVENT        EQU    6
  120. ACTION_CURRENT_VOLUME    EQU    7
  121. ACTION_LOCATE_OBJECT    EQU    8
  122. ACTION_RENAME_DISK    EQU    9
  123. ACTION_WRITE        EQU    'W'
  124. ACTION_READ        EQU    'R'
  125. ACTION_FREE_LOCK    EQU    15
  126. ACTION_DELETE_OBJECT    EQU    16
  127. ACTION_RENAME_OBJECT    EQU    17
  128. ACTION_MORE_CACHE    EQU    18
  129. ACTION_COPY_DIR        EQU    19
  130. ACTION_WAIT_CHAR    EQU    20
  131. ACTION_SET_PROTECT    EQU    21
  132. ACTION_CREATE_DIR    EQU    22
  133. ACTION_EXAMINE_OBJECT    EQU    23
  134. ACTION_EXAMINE_NEXT    EQU    24
  135. ACTION_DISK_INFO    EQU    25
  136. ACTION_INFO        EQU    26
  137. ACTION_FLUSH        EQU    27
  138. ACTION_SET_COMMENT    EQU    28
  139. ACTION_PARENT        EQU    29
  140. ACTION_TIMER        EQU    30
  141. ACTION_INHIBIT        EQU    31
  142. ACTION_DISK_TYPE    EQU    32
  143. ACTION_DISK_CHANGE    EQU    33
  144. ACTION_SET_DATE        EQU    34
  145.  
  146. ACTION_SCREEN_MODE    EQU    994
  147.  
  148. ACTION_READ_RETURN    EQU    1001
  149. ACTION_WRITE_RETURN    EQU    1002
  150. ACTION_SEEK        EQU    1008
  151. ACTION_FINDUPDATE    EQU    1004
  152. ACTION_FINDINPUT    EQU    1005
  153. ACTION_FINDOUTPUT    EQU    1006
  154. ACTION_END        EQU    1007
  155. ACTION_TRUNCATE        EQU    1022    /* fast file system only */
  156. ACTION_WRITE_PROTECT    EQU    1023    /* fast file system only */
  157.  
  158. * DOS library node structure.
  159. * This is the data at positive offsets from the library node.
  160. * Negative offsets from the node is the jump table to DOS functions
  161. * node = (STRUCT DosLibrary *) OpenLibrary( "dos.library" .. )
  162.  
  163.  STRUCTURE DosLibrary,0
  164.     STRUCT  dl_lib,LIB_SIZE
  165.     APTR    dl_Root         * Pointer to RootNode, described below
  166.     APTR    dl_GV         * Pointer to BCPL global vector
  167.     LONG    dl_A2         * Private register dump of DOS
  168.     LONG    dl_A5
  169.     LONG    dl_A6
  170.     LABEL   dl_SIZEOF *     DosLibrary
  171.  
  172. *
  173.  
  174.  STRUCTURE RootNode,0
  175.     BPTR    rn_TaskArray       * [0] is max number of CLI's
  176. *                   * [1] is APTR to process id of CLI 1
  177. *                   * [n] is APTR to process id of CLI n
  178.     BPTR    rn_ConsoleSegment  * SegList for the CLI
  179.     STRUCT  rn_Time,ds_SIZEOF  * Current time
  180.     LONG    rn_RestartSeg      * SegList for the disk validator process
  181.     BPTR    rn_Info           * Pointer ot the Info structure
  182.     BPTR    rn_FileHandlerSegment * code for file handler 
  183.     LABEL   rn_SIZEOF * RootNode
  184.  
  185.  STRUCTURE DosInfo,0
  186.     BPTR    di_McName           * Network name of this machine currently 0
  187.     BPTR    di_DevInfo           * Device List
  188.     BPTR    di_Devices           * Currently zero
  189.     BPTR    di_Handlers           * Currently zero
  190.     APTR    di_NetHand           * Network handler processid currently zero
  191.     LABEL   di_SIZEOF * DosInfo
  192.  
  193. * DOS Processes started from the CLI via RUN or NEWCLI have this additional
  194. * set to data associated with them
  195.  
  196.  STRUCTURE CommandLineInterface,0
  197.     LONG   cli_Result2           * Value of IoErr from last command
  198.     BSTR   cli_SetName           * Name of current directory
  199.     BPTR   cli_CommandDir      * Lock associated with command directory
  200.     LONG   cli_ReturnCode      * Return code from last command
  201.     BSTR   cli_CommandName     * Name of current command
  202.     LONG   cli_FailLevel       * Fail level (set by FAILAT)
  203.     BSTR   cli_Prompt           * Current prompt (set by PROMPT)
  204.     BPTR   cli_StandardInput   * Default (terminal) CLI input
  205.     BPTR   cli_CurrentInput    * Current CLI input
  206.     BSTR   cli_CommandFile     * Name of EXECUTE command file
  207.     LONG   cli_Interactive     * Boolean True if prompts required
  208.     LONG   cli_Background      * Boolean True if CLI created by RUN
  209.     BPTR   cli_CurrentOutput   * Current CLI output
  210.     LONG   cli_DefaultStack    * Stack size to be obtained in long words
  211.     BPTR   cli_StandardOutput  * Default (terminal) CLI output
  212.     BPTR   cli_Module           * SegList of currently loaded command
  213.     LABEL  cli_SIZEOF           * CommandLineInterface
  214.  
  215. * This structure can take on different values depending on whether it is
  216. * a device, an assigned directory, or a volume.     Below is the structure
  217. * reflecting volumes only.  Following that is the structure representing
  218. * only devices. Following that is the unioned structure representing all
  219. * the values
  220.   
  221. * structure representing a volume 
  222.  
  223.  STRUCTURE DevList,0
  224.     BPTR    dl_Next            ; bptr to next device list
  225.     LONG    dl_Type            ; see DLT below
  226.     APTR    dl_Task            ; ptr to handler task
  227.     BPTR    dl_Lock            ; not for volumes
  228.     STRUCT    dl_VolumeDate,ds_SIZEOF ; creation date
  229.     BPTR    dl_LockList        ; outstanding locks
  230.     LONG    dl_DiskType        ; 'DOS', etc
  231.     LONG    dl_unused
  232.     BSTR    dl_Name            ; bptr to bcpl name
  233.     LABEL    DevList_SIZEOF
  234.  
  235. * device structure (same as the DeviceNode structure in filehandler.i
  236.  
  237.  STRUCTURE     DevInfo,0
  238.     BPTR    dvi_Next
  239.     LONG    dvi_Type
  240.     APTR    dvi_Task
  241.     BPTR    dvi_Lock
  242.     BSTR    dvi_Handler
  243.     LONG    dvi_Stacksize
  244.     LONG    dvi_Priority
  245.     LONG    dvi_Startup
  246.     BPTR    dvi_SegList
  247.     BPTR    dvi_GlobVec
  248.     BSTR    dvi_Name
  249.     LABEL   dvi_SIZEOF
  250.  
  251. * combined structure for devices, assigned directories, volumes 
  252.  
  253.  STRUCTURE DosList,0
  254.     BPTR     dol_Next         ; bptr to next device on lis
  255.     LONG     dol_Type         ; see DLT below
  256.     APTR     dol_Task         ; ptr to handler task
  257.     BPTR     dol_Lock
  258.  
  259.     STRUCT    dol_VolumeDate,0    ; creation date (UNION)
  260.     BSTR    dol_Handler        ; file name to load if seglist is null
  261.     LONG    dol_StackSize        ; stacksize to use when starting process
  262.     LONG    dol_Priority        ; task priority when starting process
  263.  
  264.     STRUCT    dol_LockList,0        ; outstanding locks (UNION)
  265.     ULONG    dol_Startup        ; startup msg: FileSysStartupMsg
  266.                     ; for disks
  267.  
  268.     STRUCT    dol_DiskType,0        ; 'DOS', etc (UNION)
  269.     BPTR    dol_SegList        ; already loaded code for new task
  270.  
  271.     BPTR    dol_GlobVec        ; BCPL global vector
  272.  
  273.     BSTR    dol_Name        ; bptr to bcpl name
  274.     LABEL    DosList_SIZEOF
  275.  
  276.  
  277.  
  278. * definitions for dl_Type
  279. DLT_DEVICE    EQU    0
  280. DLT_DIRECTORY    EQU    1
  281. DLT_VOLUME    EQU    2
  282.  
  283.  
  284. * a lock structure, as returned by Lock() or DupLock()
  285.  STRUCTURE FileLock,0
  286.     BPTR    fl_Link            ; bcpl pointer to next lock
  287.     LONG    fl_Key            ; disk block number
  288.     LONG    fl_Access        ; exclusive or shared
  289.     APTR    fl_Task            ; handler task's port
  290.     BPTR    fl_Volume        ; bptr to a DeviceList
  291.     LABEL    fl_SIZEOF
  292.  
  293.     ENDC    ; LIBRARIES_DOSEXTENS_I
  294.